﻿<%@Import Namespace="System.IO"%>
<!--#include file="isLogin.aspx"-->
<script language="vb" runat=server>
dim CurFiles As String,WebNote_DirectionPath As String

Function isThisDomainFile(sFileName)	'判断是否当前服务器上的文件
	isThisDomainFile=false	'不是
	if instr(Lcase(sFileName),Lcase(WebNote_DirectionPath))>0 then
		isThisDomainFile=true
	end if
End Function

Function GetCurFiles()
	dim temStr,sNewsImgList,i
	sNewsImgList=""
	temStr=Split(CurFiles,"|")

	dim mmArt as New WebNote.WebNote()
	for i=0 to UBound(temStr)
		if temStr(i)<>"" then
			if isThisDomainFile(temStr(i)) then
				if sNewsImgList<>"" then
					sNewsImgList=sNewsImgList & "," & server.URLDecode(mmArt.GetFileName(temStr(i)))
				else
					sNewsImgList=server.URLDecode(mmArt.GetFileName(temStr(i)))
				end if
			end if
		end if
	next
	GetCurFiles=sNewsImgList
	mmArt=Nothing
End Function

Function DelRubbishFlies()
	dim ImgList,FileTypeList  As String
	FileTypeList=allow_upload_file_ext

	dim it As String,mmFileInfo as FileInfo

	dim fileExName,fileName,FilePath As String,fileSize As double
	dim mmArt as New WebNote.WebNote()
	dim mydir As  System.IO.Directory

	if mydir.Exists(Server.Mappath(WebNote_DirectionPath)) then	
		ImgList=GetCurFiles()
		ImgList=Lcase(ImgList)
		Response.write (ImgList)
		For Each it In mydir.GetFiles(Server.Mappath(WebNote_DirectionPath))
			if mmArt.CheckFileType(FileTypeList,mmArt.getFileExtensionName(it)) then
					if Not(instr(ImgList,Lcase(mmArt.getFileName2(it)))>0) then
						'response.write ("<br>删除：" & mmArt.getFileName2(it) & "<br>")
						mmArt.deleteFile(it)
					end if
			end if
		next
		if auto_remove_filesfolder then
			if mydir.GetFiles(Server.Mappath(WebNote_DirectionPath)).Length=0 then
				mydir.Delete(Server.Mappath(WebNote_DirectionPath), True) 
			end if
		end if
	end if
	
	mydir=Nothing
	mmArt=Nothing
End Function

</script>
<%
	response.clear()
	CurFiles=request.form("CurFiles")
	'response.write ("CurFiles=" & CurFiles)
	'response.end
	dim mmArt as New WebNote.WebNote()
	WebNote_DirectionPath=mmArt.DirectionPath

	mmArt=Nothing
	Call DelRubbishFlies
	response.write("true")
	response.end
%>

